import { ExtractPropTypes, PropType } from 'vue'
import { validatorSizeValue } from '../../utils'

/**
 * props参数
 */
export const virtualListProps = {
  /** 需要显示的数据 */
  data: {
    type: Array as PropType<any[]>,
    default: (): any[] => {
      return []
    }
  },
  /** 可视容器高度 */
  height: {
    type: [String, Number],
    default: '',
    validator: (value: string | number) => {
      return validatorSizeValue(value)
    }
  },
  /** 可视容器宽度 */
  width: {
    type: [String, Number],
    default: '',
    validator: (value: string | number) => {
      return validatorSizeValue(value)
    }
  },
  /** 预加载页数 */
  preloadPage: {
    type: [String, Number],
    default: 3
  },
  /** 滚动采集频率 */
  scrollGatherFreq: {
    type: [String, Number],
    default: 60
  }
}
export type VirtualListProps = ExtractPropTypes<typeof virtualListProps>

